package com.example.demo.chat;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum CommandType {
    CONNECTION(10001),
    ERROR(-1),
    CHAT(10002),
    JOIN_GROUP(10003),
    ;
    private final Integer code;
    public static CommandType match(Integer code){
        for (CommandType value: CommandType.values()){
            if (value.getCode().equals(code)){
                return value;
            }
        }
        return ERROR;
    }
}
